package com.gaojiawei.multiThread10_BlockQueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 *
 */
public class L01_ArrayBlockQueue {
    public static void main(String[] args) throws InterruptedException {
        //must inital capacity
        ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(10);

        arrayBlockingQueue.add(1);
        arrayBlockingQueue.offer(2);
        arrayBlockingQueue.offer(3,2, TimeUnit.SECONDS);
        arrayBlockingQueue.put(4);


        System.out.println(arrayBlockingQueue.remove());
        System.out.println(arrayBlockingQueue.poll());
        System.out.println(arrayBlockingQueue.poll(2, TimeUnit.SECONDS));
        System.out.println(arrayBlockingQueue.take());

    }

}
